{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e241de2d-f91b-497e-bd9c-3cc8e0850b8a",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "from bs4 import BeautifulSoup\n",
    "from urllib.parse import quote, quote_plus # 将string转为url字符\n",
    "import re\n",
    "headers = {\"Cookie\" : \"sensorsdata2015jssdkchannel=%7B%22prop%22%3A%7B%22_sa_channel_landing_url%22%3A%22%22%7D%7D; user_locale=zh-CN; oschina_new_user=false; gitee_user=true; tz=Asia%2FShanghai; Hm_lvt_24f17767262929947cc3631f99bfd274=1722926402,1722992932,1724064045; HMACCOUNT=6B63E7258241EAF5; remote_way=http; yp_riddler_id=beb85d16-f21d-4370-aea9-2cc6d74de714; csrf_token=yz3%2FscsJEVmWM5oiUuCPZWnQJA6Un597Yn8DSTxdS1zICyI5dBZRT%2BO%2BEd68eOp0LB%2B%2BPWIp0gniP%2BR7yVlS6A%3D%3D; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%229763246%22%2C%22first_id%22%3A%221912a61af37be9-0e4ab5e76b1b0a-7f5d547e-2073600-1912a61af38d6e%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMTkxMjY2YTgzNGExZjQtMDY1NDQ3YTM0YWNjNjEtN2Y1ZDU0N2UtMjA3MzYwMC0xOTEyNjZhODM0YmY3MSIsIiRpZGVudGl0eV9sb2dpbl9pZCI6Ijk3NjMyNDYifQ%3D%3D%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%24identity_login_id%22%2C%22value%22%3A%229763246%22%7D%2C%22%24device_id%22%3A%22191266a834a1f4-065447a34acc61-7f5d547e-2073600-191266a834bf71%22%7D; BEC=1f1759df3ccd099821dcf0da6feb0357; project_pr_sort=closed_at+desc; Hm_lpvt_24f17767262929947cc3631f99bfd274=1724394597; gitee-session-n=KzZWVVNOT08yMFlQYi9aWXRaaEZSeHFKVFpBc3RFdHJNSHRGNENBdjFWUUJic0pTN2FzOVZkZnRnZWg3dXdqS2E1RUFIdURzMzhVUEpKRGQ4WGFYNHMySXlyTDlabVJHR1ZvazBZdTZ5czI2dXQ3MGU1MlVHSkZwTHE1dThySmVCNiszemRkeTNYZlpabThITkx2Vm9mOXk4bzVpaytPYzcvOEZrWU8zM0NyRkZYRVJuRUFrZmhSNEJZZ0wzM1RFSSs2b2V6WWpZS3R6RUpqS2wvdFFxb1F4SE43b01rYTRTVkZIelo1Z0llZlhPOUN1dmtpdzB4Ny9PRXcvUVRIaHBmRFVsU2FwL1dUWHhiQmx5eWtNWEo0bWI5SVhtTWhKbG40V0d5VEpkOU5NeFBIcG03eC9PUTYvVnN1bkROZlhGelBMRVppcnNXcWorRUhtYkkrK2VaNm9DMDNDamZjZ2RjOFppcnZsZXcyeWg0RVh5N05EV2tlcU1RdWl0RzVqVllBU2V4amZmWGhkUWRXdXd0V0FLa0FTZS81Y1Jyb1grdTgyMExBWm0rb2szMUVXaWJ2SEliYlJ6SEFuREZnMEV5WjJ0T291RnQ3YUdaNFFQYmxJVmsrRE1mY0pvUFBXZStta2VwYVZZbm9LaHpBc1oveUp3ei9NU2xyZmlZcThvOVlnTnRSYXlzcmt3bmVOQitvMEwybHZqNnFCdzhxcFdKOGlmQ2UwaUdvMG1lcngrOUw3dDd1ZER6SXZYc24rSWxqNHFia0JPMENNY05hT0NaNkdjVmQwMllLalhWRFc2VUpjYVFYN2ZXeVl6SGdrRG55U0tWb1R6RFBnQTFyby0tZXJuWWlwVVoxcHpFalc5N0s3VjVjZz09--8c5d7b984da01f72751588d914c830225eca33f5\"}\n",
    "proxies = {\n",
    "    'http': 'http://127.0.0.1:7890',\n",
    "    'https': 'http://127.0.0.1:7890',\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1bc8ee33-8602-4e00-b565-62a6245b046a",
   "metadata": {},
   "outputs": [],
   "source": [
    "def getWithHeaders(url):\n",
    "    return requests.get(url, headers=headers, proxies=proxies).text\n",
    "def get(url):\n",
    "    return requests.get(url, headers=headers, proxies=proxies).text\n",
    "def getSoup(url):\n",
    "    return BeautifulSoup(get(url))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b09eef0e-2341-4dfa-b441-5d9dbb29fe26",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_githublink(url):\n",
    "    r = requests.get(url, headers=headers, proxies=proxies)\n",
    "    resp = r.text\n",
    "    soup = BeautifulSoup(resp)\n",
    "    s = set([tag.text for tag in soup.find_all(\"a\") if \"github\" in tag.text])\n",
    "    if len(s) == 1:\n",
    "        return s.pop()\n",
    "    else:\n",
    "        assert False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "99ce8717-8dfc-4239-919a-fd880dbc20a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_cve_title(url):\n",
    "    r = requests.get(url, headers=headers, proxies=proxies)\n",
    "    resp = r.text\n",
    "    soup = BeautifulSoup(resp)\n",
    "    s = set([tag for tag in soup.find_all(\"div\", class_=\"git-issue-description markdown-body\")])\n",
    "    assert len(s) == 1\n",
    "    tag = s.pop()\n",
    "    ret = str(tag.p.text)\n",
    "    assert \"CVE-\" in ret, \"没有找到CVE，其ISSUE链接是：\" + url \n",
    "    return ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "51609be8-d866-4378-86de-1aa441af6a23",
   "metadata": {},
   "outputs": [],
   "source": [
    "# get_githublink(\"https://gitee.com/openharmony/kernel_linux_5.10/issues/IAKFAH?from=project-issue\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "aff0ba38-046e-42b6-9e33-30561bcb7efe",
   "metadata": {},
   "outputs": [],
   "source": [
    "gitee_link = \"https://gitee.com/openharmony/kernel_linux_5.10/issues?utf8=%E2%9C%93&state=all&issue_search=%E5%AE%89%E5%85%A8%E9%97%AE%E9%A2%98\"\n",
    "resp = getWithHeaders(gitee_link)\n",
    "soup = BeautifulSoup(resp)\n",
    "urls = soup.find_all(\"a\", class_=\"title\")\n",
    "urls = [\"https://gitee.com/\"+url[\"href\"] for url in urls]\n",
    "urls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e40e83cc-fe84-41ab-983b-2997cc8c64ad",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'urls' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m cve_titles \u001b[38;5;241m=\u001b[39m [get_cve_title(issue_link) \u001b[38;5;28;01mfor\u001b[39;00m issue_link \u001b[38;5;129;01min\u001b[39;00m \u001b[43murls\u001b[49m]\n\u001b[0;32m      2\u001b[0m cve_titles\n",
      "\u001b[1;31mNameError\u001b[0m: name 'urls' is not defined"
     ]
    }
   ],
   "source": [
    "cve_titles = [get_cve_title(issue_link) for issue_link in urls]\n",
    "cve_titles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "c5836960-71c0-436a-b9ea-114a091536be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['CVE-2024-36934', 'https://lore.kernel.org/all/?q=CVE-2024-36934'],\n",
       " ['CVE-2024-36950', 'https://lore.kernel.org/all/?q=CVE-2024-36950'],\n",
       " ['CVE-2024-36954', 'https://lore.kernel.org/all/?q=CVE-2024-36954'],\n",
       " ['CVE-2024-36960', 'https://lore.kernel.org/all/?q=CVE-2024-36960'],\n",
       " ['CVE-2024-36964', 'https://lore.kernel.org/all/?q=CVE-2024-36964'],\n",
       " ['CVE-2024-36978', 'https://lore.kernel.org/all/?q=CVE-2024-36978'],\n",
       " ['CVE-2024-37353', 'https://lore.kernel.org/all/?q=CVE-2024-37353'],\n",
       " ['CVE-2024-42124', 'https://lore.kernel.org/all/?q=CVE-2024-42124'],\n",
       " ['CVE-2024-38546', 'https://lore.kernel.org/all/?q=CVE-2024-38546'],\n",
       " ['CVE-2022-48772', 'https://lore.kernel.org/all/?q=CVE-2022-48772'],\n",
       " ['CVE-2022-48806', 'https://lore.kernel.org/all/?q=CVE-2022-48806'],\n",
       " ['CVE-2024-38547', 'https://lore.kernel.org/all/?q=CVE-2024-38547'],\n",
       " ['CVE-2022-48812', 'https://lore.kernel.org/all/?q=CVE-2022-48812'],\n",
       " ['CVE-2024-38549', 'https://lore.kernel.org/all/?q=CVE-2024-38549'],\n",
       " ['CVE-2022-48813', 'https://lore.kernel.org/all/?q=CVE-2022-48813'],\n",
       " ['CVE-2024-38552', 'https://lore.kernel.org/all/?q=CVE-2024-38552'],\n",
       " ['CVE-2022-48827', 'https://lore.kernel.org/all/?q=CVE-2022-48827'],\n",
       " ['CVE-2024-38555', 'https://lore.kernel.org/all/?q=CVE-2024-38555'],\n",
       " ['CVE-2022-48828', 'https://lore.kernel.org/all/?q=CVE-2022-48828'],\n",
       " ['CVE-2023-1989', 'https://lore.kernel.org/all/?q=CVE-2023-1989']]"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cve_patch_urls = [ [cve,\"https://lore.kernel.org/all/?q=\"+quote(cve)] for cve in cve_titles ]\n",
    "cve_patch_urls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "98e675ca-5990-44e3-8b03-260083c0e9e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/'"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp = [i for i in getSoup(cve_patch_urls[0][1]).find_all(\"a\") if \"New CVE\" in i.text]\n",
    "s = \"https://lore.kernel.org/all/\"+temp[0]['href']\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "87f841bf-e453-41af-b941-7bc05d685fa1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ss = get(s)\n",
    "sss = re.search( r'CVE-2023-52882(.|\\n)*?(stable\\/(.)*]\\n)+', ss).span()\n",
    "type(sss)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "7650b144-d5a5-4720-b43e-7b9667d454f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['https://github.com/gregkh/linux/commit/06cb37e2ba6441888f24566a997481d4197b4e32',\n",
       " 'https://github.com/gregkh/linux/commit/b3948c69d60279fce5b2eeda92a07d66296c8130',\n",
       " 'https://github.com/gregkh/linux/commit/d03a82f4f8144befdc10518e732e2a60b34c870e',\n",
       " 'https://github.com/gregkh/linux/commit/cef0962f2d3e5fd0660c8efb72321083a1b531a9',\n",
       " 'https://github.com/gregkh/linux/commit/df1962a199783ecd66734d563caf0fedecf08f96',\n",
       " 'https://github.com/gregkh/linux/commit/54c2c171c11a798fe887b3ff72922aa9d1411c1e',\n",
       " 'https://github.com/gregkh/linux/commit/7fbe54f02a5c77ff5dd65e8ed0b58e3bd8c43e9c',\n",
       " 'https://github.com/gregkh/linux/commit/5ceb40cdee721e13cbe15a0515cacf984e11236b',\n",
       " 'https://github.com/gregkh/linux/commit/2d9adecc88ab678785b581ab021f039372c324cb',\n",
       " 'https://github.com/gregkh/linux/commit/8915dcd29a82096acacf54364a8425363782aea0',\n",
       " 'https://github.com/gregkh/linux/commit/a37960df7eac3cc8094bd1ab84864e9e32c91345',\n",
       " 'https://github.com/gregkh/linux/commit/4b68b861b514a5c09220d622ac3784c0ebac6c80',\n",
       " 'https://github.com/gregkh/linux/commit/e177d2e85ebcd3008c4b2abc293f4118e04eedef',\n",
       " 'https://github.com/gregkh/linux/commit/d17b75ee9c2e44d3a3682c4ea5ab713ea6073350',\n",
       " 'https://github.com/gregkh/linux/commit/8cda7577a0b4018572f31e0caadfabd305ea2786',\n",
       " 'https://github.com/gregkh/linux/commit/04bc4d1090c343025d69149ca669a27c5b9c34a7',\n",
       " 'https://github.com/gregkh/linux/commit/1726a39b0879acfb490b22dca643f26f4f907da9',\n",
       " 'https://github.com/gregkh/linux/commit/db9b31aa9bc56ff0d15b78f7e827d61c4a096e40',\n",
       " 'https://github.com/gregkh/linux/commit/38d02ba22e43b6fc7d291cf724bc6e3b7be6626b',\n",
       " 'https://github.com/bluez/bluetooth-next/commit/f132c2d13088']"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "github_links = [get_githublink(i) for i in urls] #从gitee链接中 搜索是否带有github的commit链接\n",
    "github_links"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "c72dfa93-e34c-4a49-9365-ecd6e4eee32d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<h1>目录</h1>\n",
      "<p><a href=\"#0\">CVE-2024-36934</a></p>\n",
      "<p><a href=\"#1\">CVE-2024-36950</a></p>\n",
      "<p><a href=\"#2\">CVE-2024-36954</a></p>\n",
      "<p><a href=\"#3\">CVE-2024-36960</a></p>\n",
      "<p><a href=\"#4\">CVE-2024-36964</a></p>\n",
      "<p><a href=\"#5\">CVE-2024-36978</a></p>\n",
      "<p><a href=\"#6\">CVE-2024-37353</a></p>\n",
      "<p><a href=\"#7\">CVE-2024-42124</a></p>\n",
      "<p><a href=\"#8\">CVE-2024-38546</a></p>\n",
      "<p><a href=\"#9\">CVE-2022-48772</a></p>\n",
      "<p><a href=\"#10\">CVE-2022-48806</a></p>\n",
      "<p><a href=\"#11\">CVE-2024-38547</a></p>\n",
      "<p><a href=\"#12\">CVE-2022-48812</a></p>\n",
      "<p><a href=\"#13\">CVE-2024-38549</a></p>\n",
      "<p><a href=\"#14\">CVE-2022-48813</a></p>\n",
      "<p><a href=\"#15\">CVE-2024-38552</a></p>\n",
      "<p><a href=\"#16\">CVE-2022-48827</a></p>\n",
      "<p><a href=\"#17\">CVE-2024-38555</a></p>\n",
      "<p><a href=\"#18\">CVE-2022-48828</a></p>\n",
      "<p><a href=\"#19\">CVE-2023-1989</a></p>\n",
      "</br>\n",
      "<h1 id=\"0\">CVE-2024-36934</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1Y7?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/06cb37e2ba6441888f24566a997481d4197b4e32\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36934\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-05 23:38 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS3PR01MB639106D0C6A199E3C84EE59492F92@OS3PR01MB6391.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.218-cip48</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-06-05  9:30 UTC [6%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"1\">CVE-2024-36950</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1X5?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/b3948c69d60279fce5b2eeda92a07d66296c8130\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36950\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-05 23:38 UTC [6%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS3PR01MB639106D0C6A199E3C84EE59492F92@OS3PR01MB6391.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.218-cip48</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-06-05  9:30 UTC [7%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"2\">CVE-2024-36954</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1W9?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/d03a82f4f8144befdc10518e732e2a60b34c870e\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36954\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-05 23:38 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS3PR01MB639106D0C6A199E3C84EE59492F92@OS3PR01MB6391.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.218-cip48</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-06-05  9:30 UTC [6%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"3\">CVE-2024-36960</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1VU?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/cef0962f2d3e5fd0660c8efb72321083a1b531a9\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36960\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-05 23:38 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS3PR01MB639106D0C6A199E3C84EE59492F92@OS3PR01MB6391.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.218-cip48</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-06-05  9:30 UTC [6%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"4\">CVE-2024-36964</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1QX?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/df1962a199783ecd66734d563caf0fedecf08f96\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36964\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9p2PPqHJw24RNzEa1CPDa79eWRkP_3Av4eYstisSWJYaw@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-05 23:38 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS3PR01MB639106D0C6A199E3C84EE59492F92@OS3PR01MB6391.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.218-cip48</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-06-05  9:30 UTC [6%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"5\">CVE-2024-36978</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1QJ?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/54c2c171c11a798fe887b3ff72922aa9d1411c1e\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-36978\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9pf203qrSQ5VpDTiG=U0DUa7gC1NJmJAog0y7U=TcuFjA@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-10 23:26 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [6%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9pgDiinwxFYspy19SHiqJqv5UsiguJa7ye2u7CwddOx1Q@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-26 23:24 UTC [4%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"6\">CVE-2024-37353</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1Q4?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/7fbe54f02a5c77ff5dd65e8ed0b58e3bd8c43e9c\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-37353\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [7%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9pgDiinwxFYspy19SHiqJqv5UsiguJa7ye2u7CwddOx1Q@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-26 23:24 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"7\">CVE-2024-42124</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1Q1?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/5ceb40cdee721e13cbe15a0515cacf984e11236b\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-42124\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB63887DCF9F2F6CB68BFD718E92BA2@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v5.10.223-cip51</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-08-09  8:40 UTC [6%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9pMBYkD3R3zDqMTfQEX6Qj9Nz3=1TRbiEe+KefEmu=N4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-31 22:22 UTC [4%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"8\">CVE-2024-38546</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1PO?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/2d9adecc88ab678785b581ab021f039372c324cb\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-38546\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"9\">CVE-2022-48772</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1PJ?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/8915dcd29a82096acacf54364a8425363782aea0\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48772\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [4%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9pgDiinwxFYspy19SHiqJqv5UsiguJa7ye2u7CwddOx1Q@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-26 23:24 UTC [4%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"10\">CVE-2022-48806</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1P2?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/a37960df7eac3cc8094bd1ab84864e9e32c91345\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48806\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qz-2eJhmP7m=3R=z7jQH1Ehc_gA0-bpBVnBHB61q0deQ@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-17 23:09 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"11\">CVE-2024-38547</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1OR?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/4b68b861b514a5c09220d622ac3784c0ebac6c80\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-38547\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"12\">CVE-2022-48812</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1OG?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/e177d2e85ebcd3008c4b2abc293f4118e04eedef\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48812\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qz-2eJhmP7m=3R=z7jQH1Ehc_gA0-bpBVnBHB61q0deQ@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-17 23:09 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"13\">CVE-2024-38549</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1O0?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/d17b75ee9c2e44d3a3682c4ea5ab713ea6073350\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-38549\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [6%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"14\">CVE-2022-48813</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1NU?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/8cda7577a0b4018572f31e0caadfabd305ea2786\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48813\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qz-2eJhmP7m=3R=z7jQH1Ehc_gA0-bpBVnBHB61q0deQ@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-17 23:09 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"15\">CVE-2024-38552</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1NH?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/04bc4d1090c343025d69149ca669a27c5b9c34a7\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-38552\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [6%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"16\">CVE-2022-48827</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1NG?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/1726a39b0879acfb490b22dca643f26f4f907da9\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48827\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qz-2eJhmP7m=3R=z7jQH1Ehc_gA0-bpBVnBHB61q0deQ@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-17 23:09 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"17\">CVE-2024-38555</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1N1?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/db9b31aa9bc56ff0d15b78f7e827d61c4a096e40\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2024-38555\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/OS0PR01MB6388081D4E9EA2AF33615F7E92A42@OS0PR01MB6388.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.317-cip111 and v5.10.221-cip50 and v6.1.96-cip24</a></p>\n",
      "\n",
      "   - by nobuhiro1.iwamatsu @ 2024-07-10  9:17 UTC [5%]\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qccTi6qBXT3gzRzxozhpk86SfisvN6yz1f5bwATyHK4g@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-06-20  1:46 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"18\">CVE-2022-48828</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1MY?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/gregkh/linux/commit/38d02ba22e43b6fc7d291cf724bc6e3b7be6626b\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2022-48828\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qz-2eJhmP7m=3R=z7jQH1Ehc_gA0-bpBVnBHB61q0deQ@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "   - by Masami Ichikawa @ 2024-07-17 23:09 UTC [5%]\n",
      "\n",
      "<br/>\n",
      "<h1 id=\"19\">CVE-2023-1989</h1>\n",
      "<p><a href=\"https://gitee.com//openharmony/kernel_linux_5.10/issues/IAM1M8?from=project-issue\">ISSUE LINK</a></p>\n",
      "<div><a href=\"https://github.com/bluez/bluetooth-next/commit/f132c2d13088\">GITHUB LINK</a></div>\n",
      "<p><a href=\"https://lore.kernel.org/all/?q=CVE-2023-1989\">Patchs LINK</a></p>\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qEo8oKfeuD95RngoMbaRJ13vYxbokY6rY_boroWtX5ew@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "    - by Masami Ichikawa @ 2023-09-27 22:58 UTC [5%]\n",
      "\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qZ83ftx6hw5M+fynH5oah+BB5X-iUa1wiObqz4mkJ_wg@mail.gmail.com/\">[kernel-cve-report] New CVE entries this week</a></p>\n",
      "\n",
      "    - by Masami Ichikawa @ 2023-09-20 22:51 UTC [6%]\n",
      "\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/20230917191101.481868540@linuxfoundation.org/\">[PATCH 5.10 013/406] Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition</a></p>\n",
      "\n",
      "    - by Greg Kroah-Hartman @ 2023-09-17 19:07 UTC [6%]\n",
      "\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/CAODzB9qzhsHVN8-QuYhEVjhkOaNWV-ctoGC8F=AO4Vg-B7bgVQ@mail.gmail.com/\">New CVE entries this week</a></p>\n",
      "\n",
      "    - by Masami Ichikawa @ 2023-09-06 23:22 UTC [5%]\n",
      "\n",
      "\n",
      "<p><a href=\"https://lore.kernel.org/all/TYWPR01MB9420027E9F41EC6E859C71BF92999@TYWPR01MB9420.jpnprd01.prod.outlook.com/\">[ANNOUNCE] Release v4.19.280-cip96 and v5.10.177-cip31</a></p>\n",
      "\n",
      "    - by nobuhiro1.iwamatsu @ 2023-04-14  9:19 UTC [6\n",
      "<br/>\n"
     ]
    }
   ],
   "source": [
    "print(\"<h1>目录</h1>\")\n",
    "for i in range(len(cve_patch_urls)):\n",
    "    print('<p><a href=\"#'+str(i)+'\">' + cve_patch_urls[i][0] + '</a></p>')\n",
    "\n",
    "print(\"</br>\")\n",
    "for i in range(len(cve_patch_urls)):\n",
    "    list = [patch_url for patch_url in getSoup(cve_patch_urls[i][1]).find_all(\"a\") if \"New CVE\" in patch_url.text]\n",
    "    print('<h1 id=\"'+ str(i) + '\">' + cve_patch_urls[i][0] + '</h1>')\n",
    "    print('<p><a href=\"'+urls[i]+'\">ISSUE LINK</a></p>')\n",
    "    print('<div><a href=\"'+github_links[i]+'\">GITHUB LINK</a></div>')\n",
    "    print('<p><a href=\"'+cve_patch_urls[i][1]+'\">Patchs LINK</a></p>')\n",
    "    for j in list:\n",
    "        print('<p>' + str(j).replace('href=\"', 'href=\"https://lore.kernel.org/all/') + '</p>')\n",
    "        print(j.parent.next_sibling[0:-4])\n",
    "    print(\"<br/>\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1094b347-e830-4ca8-a833-da600c08d583",
   "metadata": {},
   "outputs": [],
   "source": [
    "#从github链接来获取patch的标题从而到linux社区进行patch的搜索\n",
    "def get_githubfixtitle(url):\n",
    "    resp = requests.get(url, headers=headers, proxies = proxies).text\n",
    "    soup = BeautifulSoup(resp)\n",
    "    res = soup.find_all(class_=\"commit-title markdown-title\")\n",
    "    if len(res) == 1:\n",
    "        return res[0].text\n",
    "    else:\n",
    "        assert True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "168cf5ec-1c9c-4631-9fe4-7ff7f30a7b2c",
   "metadata": {},
   "outputs": [],
   "source": [
    "titles = [str(get_githubfixtitle(i)).strip() for i in github_links]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7d0d63be-d2f9-4eac-b9c7-e72799a73c2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "patch_urls = [[title, \"https://lore.kernel.org/all/?q=\"+quote(title)] for title in titles] \n",
    "patch_urls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f88cf4f5-04f3-451a-91d4-2bf2eb27fa06",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "print(\"<h1>目录</h1>\")\n",
    "for i in range(len(patch_urls)):\n",
    "    print('<p><a href=\"#'+str(i)+'\">' + patch_urls[i][0] + '</a></p>')\n",
    "\n",
    "print(\"</br>\")\n",
    "for i in range(len(patch_urls)):\n",
    "    list = [patch_url for patch_url in getSoup(patch_urls[i][1]).find_all(\"a\") if \"5.10\" in patch_url.text or \"CVE\" in patch_url.text]\n",
    "    print('<h1 id=\"'+ str(i) + '\">TITLE : ' + patch_urls[i][0] + '</h1>')\n",
    "    print('<p><a href=\"'+urls[i]+'\">ISSUE LINK</a></p>')\n",
    "    print('<div><a href=\"'+github_links[i]+'\">GITHUB LINK</a></div>')\n",
    "    print('<p><a href=\"'+patch_urls[i][1]+'\">Patchs LINK</a></p>')\n",
    "    for j in list:\n",
    "        print('<p>' + str(j).replace('href=\"', 'href=\"https://lore.kernel.org/all/') + '</p>')\n",
    "        print(j.parent.next_sibling[0:-4])\n",
    "    print(\"<br/>\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "56d653a3-8934-47e1-9f3e-bf2ffc1c7fb4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "\n",
    "# 将print输出重定向到文件\n",
    "\n",
    "with open('D:\\\\test.html', 'w') as f:\n",
    "    sys.stdout = f\n",
    "    print(\"<h1>目录</h1>\")\n",
    "    for i in range(len(patch_urls)):\n",
    "        print('<p><a href=\"#'+str(i)+'\">' + patch_urls[i][0] + '</a></p>')\n",
    "    \n",
    "    print(\"</br>\")\n",
    "    for i in range(len(patch_urls)):\n",
    "        list = [patch_url for patch_url in getSoup(patch_urls[i][1]).find_all(\"a\") if \"5.10\" in patch_url.text or \"CVE\" in patch_url.text]\n",
    "        print('<h1 id=\"'+ str(i) + '\">TITLE : ' + patch_urls[i][0] + '</h1>')\n",
    "        print('<p><a href=\"'+urls[i]+'\">ISSUE LINK</a></p>')\n",
    "        print('<div><a href=\"'+github_links[i]+'\">GITHUB LINK</a></div>')\n",
    "        print('<p><a href=\"'+patch_urls[i][1]+'\">Patchs LINK</a></p>')\n",
    "        for j in list:\n",
    "            print('<p>' + str(j).replace('href=\"', 'href=\"https://lore.kernel.org/all/') + '</p>')\n",
    "            print(j.parent.next_sibling[0:-4])\n",
    "        print(\"<br/>\")\n",
    "sys.stdout = sys.__stdout__\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "9e075439-e6c0-40e1-b00b-2d1b623f99be",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "【漏洞】 【OpenHarmony-4.0-Release】 CVE-2024-41098\n",
      "【漏洞】 【master】 CVE-2024-41098\n",
      "【安全】【九州】【OpenHarmony:kernel_linux_5.10】【OH红军】【模块】: 系统服务管理\n",
      "[Bug]: Openharmony4.1中打开CONFIG_ANDROID_BINDERFS=y，编译出来的镜像烧录在RK3568上启动不起来\n",
      "【Openharmony_4.1_release】【RK3568】【必现】【Kernel_linux_5.10】打开编译选项CONFIG_BLK_CGROUP后编译失败\n",
      "[Bug]: 【Sample】【Openharmony_ 5.0.0.24】【rk3568】【必现】【kernel_linux_5.10应用子系统】【Toc】AppRecovery：应用回到桌面后应用不能被重启\n"
     ]
    }
   ],
   "source": [
    "gitee_link = \"https://gitee.com/openharmony/kernel_linux_5.10/issues?page=3&state=open\"\n",
    "resp = getWithHeaders(gitee_link)\n",
    "soup = BeautifulSoup(resp)\n",
    "urls = soup.find_all(\"a\", class_=\"title\")\n",
    "titles = [url[\"title\"] for url in urls]\n",
    "len(titles)\n",
    "for e in titles:\n",
    "    print(e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "da78ac20",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Introduced by commit is not determined.Fixed in v6.8-rc1.\\nAffected functions svm_range_evict_svm_bo_worker() was added by commit'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import re\n",
    "resp_text = \"\"\"\n",
    "Introduced by commit 3174603 (\"bpf: Introduce bpf_arena.\") in v6.9-rc1.\n",
    "Fixed in v6.10-rc6.\n",
    "Bug introduced commit is not backported to older stable kernels.\n",
    "\n",
    "Fixed status\n",
    "mainline: [b90d77e5fd784ada62ddd714d15ee2400c28e1cf]\n",
    "\n",
    "CVE-2024-42076: net: can: j1939: Initialize unused data in j1939_send_one()\n",
    "\n",
    "Announce: https://lore.kernel.org/linux-cve-announce/2024072954-CVE-2024-42076-a9bd@gregkh/\n",
    "\n",
    "Introduced by commit 9d71dd0 (\"can: add support of SAE J1939\n",
    "protocol\") in v5.4-rc1.\n",
    "Fixed in v6.10-rc6.\n",
    "Bug introduced commit is not backported to older stable kernels.\n",
    "\n",
    "Fixed status\n",
    "mainline: [b7cdf1dd5d2a2d8200efd98d1893684db48fe134]\n",
    "stable/5.10: [a2a0ebff7fdeb2f66e29335adf64b9e457300dd4]\n",
    "stable/5.15: [4c5dc3927e17489c1cae6f48c0d5e4acb4cae01f]\n",
    "stable/5.4: [5e4ed38eb17eaca42de57d500cc0f9668d2b6abf]\n",
    "stable/6.1: [f97cbce633923588307049c4aef9feb2987e371b]\n",
    "stable/6.6: [ab2a683938ba4416d389c2f5651cbbb2c41b779f]\n",
    "\n",
    "CVE-2024-42077: ocfs2: fix DIO failure due to insufficient transaction credits\n",
    "\n",
    "Announce: https://lore.kernel.org/linux-cve-announce/2024072954-CVE-2024-42077-ff2b@gregkh/\n",
    "\n",
    "Introduced by commit c15471f (\"ocfs2: fix sparse file & data ordering\n",
    "issue in direct io\") in v4.6-rc1.\n",
    "Fixed in v6.10-rc6.\n",
    "Bug introduced commit is not backported to older stable kernels.\n",
    "\n",
    "Fixed status\n",
    "mainline: [be346c1a6eeb49d8fda827d2a9522124c2f72f36]\n",
    "stable/5.10: [a68b896aa56e435506453ec8835bc991ec3ae687]\n",
    "stable/5.15: [320273b5649bbcee87f9e65343077189699d2a7a]\n",
    "stable/6.1: [9ea2d1c6789722d58ec191f14f9a02518d55b6b4]\n",
    "stable/6.6: [c05ffb693bfb42a48ef3ee88a55b57392984e111]\n",
    "\"\"\"\n",
    "all_match_text = re.search( r'{}(.|\\n)*?(stable\\/(.)*]\\n)+'.format('CVE-2024-42076'), resp_text).group()\n",
    "re.search(r'Introduced by commit(.)*\\n(.)*', all_match_text).group()\n",
    "re.search(r'CVE-2024-42076: (.)*\\n', all_match_text).group().strip().strip('CVE-2024-42076: ')\n",
    "re.search(r'Introduced by commit(.)*\\n(.)*', all_match_text).group()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "5f0a836c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'it is not determined.Fixed in v6.8-rc1.\\ns390 is not supported by the CIP.'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'Introduced commit is not determined.Fixed in v6.8-rc1.\\ns390 is not supported by the CIP.'.strip(\"Introduced comm\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
